Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Codable saving functionality #167

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

kevin-hv
Copy link

@kevin-hv kevin-hv commented Mar 28, 2021

Hey! I really missed the functionality of saving objects conforming to the Codable protocol.

This code lives in an extension now in my projects. But I was wondering whether this could get into the main codebase.

Example code:

struct UserInfo : Codable {
    let firstName : String
    let lastName : String
}

KeychainWrapper.standard.set(UserInfo(firstName: "Kevin", lastName: "Varga Halász"), forKey: KeychainWrapper.Key.userInfo.rawValue)

guard let userInfo : UserInfo = KeychainWrapper.standard.codable(forKey: .userInfo) else { return }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant